<template>
  <scroll-view
    v-if="Object.values(data).length"
    scroll-y="true"
    class="content"
  >
    <uni-section title="停工信息" type="line">
      <uni-card class="card">
        <text class="card-item" v-for="(i, z) in columns" :key="z"
          >{{ i.title }}：{{ data[i?.dataIndex] }}</text
        >
      </uni-card>
    </uni-section>

    <uni-section
      title="审核信息"
      type="line"
      v-if="data?.activitiInstance?.hitTasks?.length"
    >
      <uni-list
        v-for="(item, j) in data?.activitiInstance?.hitTasks"
        :key="j"
        :title="item.taskName || '审核意见'"
      >
        <uni-list-item
          ellipsis="1"
          v-for="(value, index) in ApprovalInfo"
          :class="index === 0 ? 'bold-title-uni-list' : ''"
          :key="index"
          :title="value.title"
          :rightText="item[value.key]"
        />

        <uni-list-item
          ellipsis="1"
          v-for="(list, j) in item.taskAttachmentList || []"
          :key="j"
          :title="list.attachmentName"
        >
          <template v-slot:footer>
            <text
              class="download"
              @click="downloadFile(`${baseUrl}${list?.attachmentPath}`)"
              >查看</text
            >
          </template>
        </uni-list-item>
      </uni-list>
    </uni-section>
  </scroll-view>

  <view v-else class="no-data"> 暂无数据 </view>
</template>
  
  <script>
import request, { baseUrl } from "@/utils/httpInterceptor";
import { downloadFile } from "@/utils/download";
import { ApprovalInfo } from "../todoList/api";
import { columns } from "./api";
export default {
  data() {
    return {
      id: "",
      data: {},
      ApprovalInfo,
      columns,
      baseUrl
    };
  },

  computed: {},
  onLoad: function (option) {
    this.id = option.id;
    this.getDetail();
  },

  methods: {
    downloadFile,

    async getDetail() {
      uni.showLoading()
      const res = await request({
        url: `/acid/stoppage-record/${this.id}`,
        method: "GET",
      });

      this.data = res.data || {};
    },
  },
};
</script>
  
  <style lang="scss" scoped>
.action-number {
  padding: 0 10px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  position: fixed;
  bottom: 45px;
  width: 100%;
  border-top: 1px solid #eee;
  height: 35px;
  align-items: center;
}
</style>
  